package common.quickvalid.validators;

import java.util.Map;

/**
 * 必须选中一项值表单域验证
 * 非空域, 全部空格也算空.
 * 
 * validate-one-required
 * @author beansoft
 *
 */
public class validate_one extends BaseValidator {

	public String doValidation(String fieldName, String fieldDescription,
	        Map<String, Object> params, String... args) {
		super.setParams(params);		
		String value = getValue(fieldName);
		
		if(value == null || value.length() == 0 || value.trim().length() == 0) {
			return fieldDescription + "必须至少选中一项";
		}
		return null;
	}

}